package com.yqya.springboot.websocket.chat.constants;

/**
 * 消息常量类
 *
 * @author Kevin
 * @date 2019-07-07
 */
public class MessageConstants {

    /**
     * 类型枚举类
     */
    public enum TypeEnum {
        ENTER("ENTER", "发送"),
        SPEAK("SPEAK", "对话"),
        QUIT("QUIT", "退出"),;

        /**
         * 值
         */
        private String value;

        /**
         * 名称
         */
        private String name;

        public String getValue() {
            return value;
        }

        public String getName() {
            return name;
        }

        TypeEnum(String value, String name) {
            this.value = value;
            this.name = name;
        }

        public static String getName(String value) {
            for (TypeEnum e : TypeEnum.values()) {
                if (e.value.equals(value)) {
                    return e.name;
                }
            }
            return "";
        }
    }

}
